home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
index.php
< prev
next >
Wrap
PHP Script
|
2010-05-19
|
8KB
|
207 lines
<?php
/**
* MAIN PAGE
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category NA
* @package NA
* @author Nicolas Bruley / Peer 2 World <contact@weezo.net>
* @copyright 2005-2009 Nicolas Bruley / Peer 2 World
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
* @link http://www.weezo.net
* @since File available since Release 1.0.0
*/
/**
* @desc logout user
*
*/
function indexLogout(){
$logoutToLoginPage=cfGGetVar('logoutToLoginPage');
// if user is actually connected
if (isset($_SESSION['userLogged'])){
// Save icon's position and persistant resources vars (only if single user profile or admin)
if(WEnv::user()->isAdministrator() || WEnv::user()->getVar('accountType')=='singleUser'){
// Browse active items (background icons)
foreach (cfGGetVar('activeItems') as $item) if($item['type']=='icon' && isset($item['resourceFilename']) && $item['x']!==null && $item['y']!==null){
foreach (WEnv::user()->getResources() as $rid=>$rfn) if($rfn==$item['resourceFilename']) {
WEnv::user()->updateResource($rid,'iconPosition',$item['x'].'x'.$item['y']);
}
}
// Save persistant resources vars
WEnv::user()->saveVar('savedRVars',false);
// Save user if needed
WEnv::user()->save();
}
// inform application of disconnection and log logout
cfServerSendCommand('log disconnected="'.wSession_id().'"');
// Log it as event
//if(!cfUGetVar('invisible')) cfLogEvent(cfCaption('logUserLogout',false,false,false,true).' ('.cfUTF8Encode(cfUGetVar('name')).')',EVENT_CONNECTION,S_EVENT_LOGOUT);
// Log disconnection into stats database
require_once(INCLUDE_DIR.'databaseFunctions.php');
dbLogDisconnection();
cfLog(cfCaption('logUserLogout',false,false,false,true).' ('.cfUTF8Encode(cfUGetVar('name').')'.((cfUGetVar('pseudo'))?' - '.cfUGetVar('pseudo'):'')),LOG_INF,true);
// destroy session directory
if(cfAppUserTempDir(false)) cfUnlinkDir(cfAppUserTempDir(false));
// remove access to doc root subdirs
cfHtaccessGrant(false,'remove');
}
else cfLog('Log out required by non logged user (session has probably expired)',LOG_INF);
// Destroy cookie
setcookie('WSESSID', '', time()-42000, '/');
// destroy session
if(!wSession_destroy()){
wSession_start();
wSession_destroy();
}
// Site accessed through portal
if(($_POST['logout']=='top' && !$logoutToLoginPage) || !cfDirectWebConnectionsAllowed()) {echo '<script langage="javascript">top.location.href="'.APP_SITE.'";</script>'; exit;}
// Else, go back to login page
require_once(cfAppDocRoot().'/login.php');
exit();
}
// Start session if client send a session id
//if(isset($_COOKIE['WSESSID'])) cfDbg($_COOKIE['WSESSID']);
if(isset($_COOKIE['WSESSID'])) wSession_start();
/*
***************************************************************************************************************************
* If logout order received, destroy & reload session
***************************************************************************************************************************
*/
if(isset($_POST['logout'])) indexLogout();
// Theme change command received
if(isset($_POST['themeUpdate']) && isset($_POST['themeLevel']) && cfGGetVar('allowUserThemeChange')){
if($_POST['themeLevel']=='general') cfGSetVar('theme', cfUTF8Decode($_POST['themeUpdate']));
if($_POST['themeLevel']=='user') cfUSetVar('theme', cfUTF8Decode($_POST['themeUpdate']));
if($_POST['themeLevel']=='resource') cfRSetVar('theme', cfUTF8Decode($_POST['themeUpdate']));
}
if(isset($_GET['themeUpdate']) && isset($_GET['themeLevel']) && cfGGetVar('allowUserThemeChange')){
if($_GET['themeLevel']=='general') cfGSetVar('theme', cfUTF8Decode($_GET['themeUpdate']));
if($_GET['themeLevel']=='user') cfUSetVar('theme', cfUTF8Decode($_GET['themeUpdate']));
if($_GET['themeLevel']=='resource') cfRSetVar('theme', cfUTF8Decode($_GET['themeUpdate']));
}
// Get user screen size
if (isset($_GET['userScreenWidth'])) cfGSetVar('userScreenWidth',$_GET['userScreenWidth']);
if (isset($_GET['userScreenHeight'])) cfGSetVar('userScreenHeight',$_GET['userScreenHeight']);
/*
***************************************************************************************************************************
* If user not logged-in, display authentication form
***************************************************************************************************************************
*/
if(!isset($_SESSION['userLogged'])) {
if(isset($_GET['loginOK'])) $securityEvent=cfCaption('securityNoSession');
require(cfAppDocRoot().'/login.php');
exit;
}
/*
***************************************************************************************************************************
* User logged-in
***************************************************************************************************************************
*/
// Standalone resource: redirect to resource
if(cfUGetVar('publishToken')) {header('Location: '.$_SESSION['res'][0]['resourceJsLink']);exit;}
require(cfAppDocRoot().'/mainFrame.php');
exit;
// Frameless theme or single-frame theme
if(!cfTGetVar('frames') || cfTGetVar('framelessDesktop')){
$_ENV['framelessDesktop']=1;
require(cfAppDocRoot().'/mainFrame.php');
exit;
}
// Get theme layout data
$menuFrameThemeData=cfTGetVar('menuFrame');
$menuFramePosition=$menuFrameThemeData['position'];
$menuFrameSize=$menuFrameThemeData['size'];
$menuFrameScrolling=$menuFrameThemeData['scrolling']; if($menuFrameScrolling===0) $menuFrameScrolling='NO';
// 2-frames theme
cfInsertBasicHEAD(false,true);
// Get theme information for main panel position
$themeDirectory=cfAppThemeDir(false);
// Load menu script
if(file_exists($themeDirectory.'/menu.php')) require($themeDirectory.'/menu.php'); else require(W_THEMES_DIR.'common/menu.php');
// Set windows borders total width and total height
$mainFrameThemeData=cfTGetVar('mainFrame');
echo '<link rel="shortcut icon" href="favicon.ico"></head>'."\n";
?>
<script type="text/javascript">
function reloadFrames(){document.location.href='/index.php';}
function resizeMenuFrame(nd){
<?php
if(in_array($menuFramePosition,array('top','left','bottom','right')) && isset($menuFrameSize)){
switch ($menuFramePosition){
case 'top': echo "dgi('menuFrame').rows=nd + \",*\";";break;
case 'bottom': echo "dgi('menuFrame').rows=\"*,\" + nd;";break;
case 'right': echo "dgi('menuFrame').cols=\"*,\" + nd;";break;
case 'left': echo "dgi('menuFrame').cols=nd + \",*\";";break;
}
}
?>
}
</script>
<?php
if(isset($stretchedBackground)) cfGSetVar('stretchedBackground',$stretchedBackground); else cfGSetVar('stretchedBackground',false);
$mfSource='/mainFrame.php';
// Set frames
switch ($menuFramePosition){
case 'top': echo '<frameset id="menuFrame" rows="'.$menuFrameSize.',*" frameborder="no" framespacing="0" border="0">';break;
case 'bottom': echo '<frameset id="menuFrame" rows="*,'.$menuFrameSize.'" frameborder="no" framespacing="0" border="0">';break;
case 'right': echo '<frameset id="menuFrame" cols="*,'.$menuFrameSize.'" frameborder="no" framespacing="0" border="0">';break;
case 'left': echo '<frameset id="menuFrame" cols="'.$menuFrameSize.',*" frameborder="no" framespacing="0" border="0">';break;
}
// Left / top menu
if($menuFramePosition=='left' || $menuFramePosition=='top') echo '<frame src="menuFrame.php" name="menuFrame" frameborder="yes" border="1" noresize scrolling="'.$menuFrameScrolling.'">'."\n";
// main frame
echo '<frame src="'.$mfSource.'" name="mainFrame" frameborder="no" border="0" noresize scrolling="NO">';
// Right / bottom menu
if($menuFramePosition=='right' || $menuFramePosition=='bottom') echo '<frame src="menuFrame.php" name="menuFrame" frameborder="yes" border="1" noresize scrolling="'.$menuFrameScrolling.'">'."\n";
?>
</frameset>
</HTML>